package com.jinlejia.erp.utils;

import android.app.Activity;

import java.util.ArrayList;

/**
 * @author SongJiaTai
 * @description:Activity管理器 关闭多个Activity
 * @date :2020/8/26 15:26
 */
public class ActivityCollector {
    public static ArrayList<Activity> activityies = new ArrayList<>();
    public static ArrayList<Activity> activityies2 = new ArrayList<>();

    public static void addActivity(Activity activity) {
        activityies.add(activity);
    }

    public static void removeActivity(Activity activity) {
        activityies.remove(activity);
    }

    public static void finishAll() {
        for (Activity activity : activityies) {
            if (!activity.isFinishing()) {
                activity.finish();
            }
        }
    }



    public static void addActivity2(Activity activity) {
        activityies2.add(activity);
    }

    public static void removeActivity2(Activity activity) {
        activityies2.remove(activity);
    }

    public static void finishAll2() {
        for (Activity activity : activityies2) {
            if (!activity.isFinishing()) {
                activity.finish();
            }
        }
    }

}
